<?php
//  AES使用代码
//加载解密处理类
include_once "wxBizDataCrypt.php";

//1：wx后台得到
$appid = 'wx4f4bc4dec97d474b';

//2：[客户端]发送到服务器js_code（服务器用js_code换取sessionKey） sessionkey有过期时间 [客户端发送之前需验证是否过期]
$sessionKey = 'tiihtNczf5v6AKRyjwEUhQ==';

//3：[客户端]发送到服务器（客户端getUserInfo()获取）
$encryptedData="CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZM
                QmRzooG2xrDcvSnxIMXFufNstNGTyaGS
                9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+
                3hVbJSRgv+4lGOETKUQz6OYStslQ142d
                NCuabNPGBzlooOmB231qMM85d2/fV6Ch
                evvXvQP8Hkue1poOFtnEtpyxVLW1zAo6
                /1Xx1COxFvrc2d7UL/lmHInNlxuacJXw
                u0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn
                /Hz7saL8xz+W//FRAUid1OksQaQx4CMs
                8LOddcQhULW4ucetDf96JcR3g0gfRK4P
                C7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB
                6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns
                /8wR2SiRS7MNACwTyrGvt9ts8p12PKFd
                lqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYV
                oKlaRv85IfVunYzO0IKXsyl7JCUjCpoG
                20f0a04COwfneQAGGwd5oa+T8yO5hzuy
                Db/XcxxmK01EpqOyuxINew==";

//4：[客户端]发送到服务器（客户端getUserInfo()获取）
$iv = 'r7BXXKkLb8qrSNn05n0qiA==';

//用appid、sessionKey初始化“解密处理类
$pc = new WXBizDataCrypt($appid, $sessionKey);

//执行解密，正确返回$data，错误返回$errCode
$errCode = $pc->decryptData($encryptedData, $iv, $data );

if ($errCode == 0) {  //0表示正常
    print($data);
} else {
    print($errCode);
}

